{% extends 'base.html' %}

{% block title %}
发布问答
{% endblock %}

{% block head %}
    <link rel="stylesheet" href="{{ url_for('static',filename='css/question.css') }}">
    <script language="JavaScript" type="text/javascript">
          function clearNoNum(event,obj){
            //响应鼠标事件，允许左右方向键移动
            event = window.event||event;
            if(event.keyCode == 37 | event.keyCode == 39){
                return;
            }
            //先把非数字的都替换掉，除了数字和.
            obj.value = obj.value.replace(/[^\d.]/g,"");
            //必须保证第一个为数字而不是.
            obj.value = obj.value.replace(/^\./g,"");
            //保证只有出现一个.而没有多个.
            obj.value = obj.value.replace(/\.{2,}/g,".");
            //保证.只出现一次，而不能出现两次以上
            obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
          }
    </script>
{% endblock %}

{% block body %}
    <h3 class="page-title">添加记录</h3>
    <form action="#" method="post">

    <div class="form-container">

{#        <div class="form-group">#}
{#     <div class="dropdown">#}
{#    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">#}
{#        Dropdown#}
{#        <span class="caret"></span>#}
{#    </button>#}
{#    <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">#}
{#        <li><a href="#">Action</a></li>#}
{#        <li><a href="#">Another action</a></li>#}
{#        <li><a href="#">Something else here</a></li>#}
{#        <li role="separator" class="divider"></li>#}
{#        <li><a href="#">Separated link</a></li>#}
{#    </ul>#}
{#    </div>#}


{#        </div>#}

        <div class="form-group ctype">
            <label for="">消费类型：</label>
            <select name="ctype" id="">
                {% for ctype in ctypeList %}
                    <option value="{{ ctype.id }}">{{ ctype.title }}</option>
                {% endfor %}
            </select>
        </div>

        <div class="form-group">
            <input type="text" onkeyup="clearNoNum(event,this)" onafterpaste="clearNoNum(event,this)" name="title" placeholder="请输入消费的金额" class="form-control">
        </div>
        <div class="form-group">
            <textarea name="content" rows="5" placeholder="请输入消费的备注内容" class="form-control"></textarea>
        </div>
        <div class="form-group">
            <button class="btn btn-primary">立即发布</button>
        </div>
    </div>
    </form>
{% endblock %}